home *** CD-ROM | disk | FTP | other *** search
- unit scrprt;
- {$A-,B-,D-,E-,F-,L-,N-,O-,R-,S-,V-}
-
- interface
-
- procedure screenprint(pg: byte; pgname, vernum: string);
-
- implementation
-
- uses
- Dos, Crt, externs;
-
- const
- ESC = #27;
-
- type
- charset = set of char;
-
-
- procedure modeinfo(var vidmode, vidlen, vidpg: byte; var vidwid: word);
- var
- regs: registers;
-
- begin
- with regs do
- begin
- AH:=$0F;
- Intr($10, regs);
- vidmode:=AL;
- vidwid:=AH;
- vidpg:=BH;
- AX:=$1A00;
- Intr($10, regs);
- if AL = $1A then
- vidlen:=Mem[$40:$84] + 1;
- AX:=$1200;
- BL:=$10;
- Intr($10, regs);
- if BL = $10 then
- vidlen:=25
- else
- vidlen:=Mem[$40:$84] + 1;
- end
- end; {modeinfo}
-
- procedure box;
- const
- frame: array[1..8] of char = '╔═╗║║╚═╝';
- var
- h, w, x, y: word;
-
- begin
- w:=Lo(WindMax) - Lo(WindMin) + 1;
- h:=Hi(WindMax) - Hi(WindMin) + 1;
- Inc(WindMax, $0101);
- GotoXY(1, 1);
- Write(frame[1]);
- for x:=2 to w - 1 do
- Write(frame[2]);
- GotoXY(w, 1);
- Write(frame[3]);
- for y:=2 to h - 1 do
- begin
- GotoXY(1, y);
- Write(frame[4]);
- GotoXY(w, y);
- Write(frame[5]);
- end;
- GotoXY(1, h);
- Write(frame[6]);
- GotoXY(2, h);
- for x:=2 to w-1 do
- Write(frame[7]);
- GotoXY(w, h);
- Write(frame[8]);
- Dec(WindMax, $0202);
- Inc(WindMin, $0101);
- end;
-
- function getkey(cs: charset): char;
- var
- c, x: char;
-
- begin
- repeat
- c:=UpCase(ReadKey);
- if KeyPressed and (c = #0) then
- x:=ReadKey;
- until c in cs;
- if Ord(c) > 31 then
- Writeln(c);
- getkey:=c
- end;
-
- function today: string;
- const
- downame: array[0..6] of string[3] = ('Sun', 'Mon', 'Tue', 'Wed', 'Thu',
- 'Fri', 'Sat');
- monthname: array[1..12] of string[3] = ('Jan', 'Feb', 'Mar', 'Apr', 'May',
- 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
- 'Nov', 'Dec');
- var
- regs: registers;
- dayform, year, month, day, dow: word;
- yearstr, daystr: string[5];
- cinfo: array[0..$21] of byte;
- temp: string;
-
- begin
- GetDate(year, month, day, dow);
- with regs do
- begin
- AH:=$38;
- AL:=0;
- DS:=Seg(cinfo);
- DX:=Ofs(cinfo);
- MsDos(regs);
- dayform:=cinfo[0] + (word(256) * cinfo[1]);
- end;
- Str(day, daystr);
- Str(year, yearstr);
- case dayform of
- 0,3..$FFFF: temp:=monthname[month] + ' ' + daystr + ', ' + yearstr;
- 1: temp:=daystr + ' ' + monthname[month] + ', ' + yearstr;
- 2: temp:=yearstr + ' ' + monthname[month] + ' ' + daystr;
- end;
- today:=downame[dow] + ', ' + temp
- end; {today}
-
- function time: string;
- var
- regs: registers;
- hour, min, sec, sec100: word;
- hourstr, minstr, secstr: string[2];
- cinfo: array[0..$21] of byte;
- tform: byte;
- tsep: char;
- temp: string[11];
-
- begin
- GetTime(hour, min, sec, sec100);
- with regs do
- begin
- AH:=$38;
- AL:=0;
- DS:=Seg(cinfo);
- DX:=Ofs(cinfo);
- MsDos(regs);
- tform:=cinfo[$11];
- tsep:=Chr(cinfo[$D]);
- end;
- Str(hour, hourstr);
- if (hour > 12) and (tform and 1 = 0) then
- Str(hour - 12, hourstr);
- if (hour = 0) and (tform and 1 = 0) then
- hourstr:='12';
- Str(min, minstr);
- if Length(minstr) = 1 then
- minstr:='0' + minstr;
- Str(sec, secstr);
- if Length(secstr) = 1 then
- secstr:='0' + secstr;
- temp:=hourstr + tsep + minstr + tsep + secstr;
- if (tform and 1 = 0) then
- if hour > 11 then
- temp:=temp + ' pm'
- else
- temp:=temp + ' am';
- time:=temp
- end; {time}
-
-
- procedure screenprint(pg: byte; pgname, vernum: string);
- const
- lochars: array[#0..#$1F] of char = ' abcdefghijklmno' +
- 'pqrstuvwxyz<+>^v';
-
- hichars: array[#$80..#$FF] of char = 'cueaaaaceeeiiiAA' +
- {90h} 'EaAooouuyOUcLYPf' +
- {A0h} 'aiounNao?++24i<>' +
- {B0h} '.oO|++++++|+++++' +
- {C0h} '++++-++++++++-++' +
- {D0h} '++++++++++++_||~' +
- {E0h} 'aBr#Eout00^o80EU' +
- {F0h} '=+><fj-~oOojn2O ';
- dashes: string[79] = '----------------------------------------' +
- '---------------------------------------';
-
- var
- scrbuf: array[0..7999] of char;
- vidmode, vidlen, vidpg, oldattr: byte;
- vidwid, vidseg, x, bpl, bps, charcount, first, last: word;
- regs: registers;
- outfile: text;
- filename: PathStr;
- monoscrn: array[0..3999] of char absolute $B000:0;
- colorscrn: array[0..7999] of char absolute $B800:0;
- c: char;
- striphi: boolean;
- extrastr: string;
-
- procedure cleanup;
- begin
- if vidmode = 7 then
- Move(scrbuf, monoscrn, 4000)
- else
- Move(scrbuf, colorscrn, 8000);
- TextAttr:=OldAttr;
- end;
-
- begin
- oldattr:=TextAttr;
- modeinfo(vidmode, vidlen, vidpg, vidwid);
- if vidmode = 7 then
- Move(monoscrn, scrbuf, 4000)
- else
- Move(colorscrn, scrbuf, 8000);
- TextColor(White);
- TextBackground(Blue);
- Window(5, (vidlen div 2) - 5, 75, (vidlen div 2) + 5);
- box;
- TextBackground(LightGray);
- TextColor(Black);
- ClrScr;
- Write('Dump screen to a <F>ile or the <P>rinter.=>');
- c:=getkey([ESC, 'F', 'P']);
- if c = ESC then
- begin
- cleanup;
- Exit
- end;
- if c = 'P' then
- begin
- Assign(outfile, 'PRN');
- ReWrite(outfile)
- end
- else
- begin
- Write('Filename to use.=>');
- Readln(filename);
- if filename = '' then
- begin
- cleanup;
- Exit
- end;
- filename:=FExpand(filename);
- Assign(outfile, filename);
- {$I-} Reset(outfile); {$I+}
- if IOResult = 0 then
- begin
- Write(filename, ' exists! <O>verwrite, <A>ppend, <Q>uit.=>');
- c:=getkey([ESC, 'O', 'A', 'Q']);
- case c of
- ESC, 'Q': begin
- Close(outfile);
- cleanup;
- Exit
- end;
- 'A': begin
- Close(outfile);
- Append(outfile)
- end;
- 'O': begin
- Close(outfile);
- ReWrite(outfile)
- end
- end
- end
- else
- ReWrite(outfile);
- end;
- Write('<N>ormal ASCII or <I>BM ASCII.=>');
- c:=getkey([ESC, 'N', 'I']);
- if c = ESC then
- begin
- cleanup;
- Exit
- end;
- if c = 'N' then
- striphi:=true
- else
- striphi:=false;
- Write('Do you wish to add an extra header line? <Y> or <N>.=>');
- c:=getkey([ESC, 'Y', 'N']);
- if c = ESC then
- begin
- cleanup;
- Exit
- end;
- extrastr:='';
- if c = 'Y' then
- begin
- Write('Header>');
- Readln(extrastr);
- end;
- bpl:=vidwid * 2;
- bps:=bpl * vidlen;
- {0 is top, print from line 2 to vidlen-2}
- charcount:=0;
- first:=bpl * 2;
- last:=bps - (bpl * 2) - 1;
- Writeln(outfile, dashes);
- if Length(extrastr) > 0 then
- Writeln(outfile, extrastr);
- Writeln(outfile, 'Infoplus ', vernum, ' Page ', pg, ' - ', pgname);
- Writeln(outfile, 'Generated: ', today, ' at ', time);
- Writeln(outfile, dashes);
- x:=first;
- repeat
- c:=scrbuf[x];
- if Ord(c) < 31 then
- c:=lochars[c];
- if striphi and (Ord(c) > 127) then
- c:=hichars[c];
- Write(outfile, c);
- Inc(charcount);
- if charcount = 80 then
- begin
- Writeln(outfile);
- charcount:=0;
- end;
- Inc(x, 2);
- until x >= last;
- Writeln(outfile);
- Close(outfile);
- cleanup
- end;
- end.